// ts是js的超集
interface Foo{
    type:'foo'
}
interface Bar{
    type:'bar'
}
type All = Foo | Bar ;
function handleValue(val :All){
    switch(val.type){
        case 'foo':
            break;
        case 'bar':
            break;
        default:

    }
}